package com.han.walkman.service.impl;

import com.han.walkman.dao.UserDao;
import com.han.walkman.entity.UserEntity;
import com.han.walkman.service.UserService;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/6/12
 * @Desc:
 */
@Service
public class UserServiceImpl implements UserService {

    private final UserDao userDao;

    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void add(UserEntity userEntity) {
        userDao.save(userEntity);
    }

    @Override
    public List<UserEntity> findAllByEntity(UserEntity userEntity) {
        return userDao.findAll(Example.of(userEntity));
    }
}
